using System;
using System.Configuration;
using System.Net.Mail;

/*This will have to be cleaned up. 
 * The email functionality exists in InsightUtilities project
 */
namespace PHSRAG.Utility
{
    public static class EmailNotification
    {
        public static void SendEmail(string EmailBody)
        {
            string FromEmail = Utility.Settings.GetKeyValue("FromEmail", "PHSInsightHelpdesk@partners.org");
            string ToEmail = Utility.Settings.GetKeyValue("ToEmail", "atarafder@partners.org");
            string subject = Utility.Settings.GetKeyValue("EmailSubject", "Error Notification");

            MailMessage mailMessage = new MailMessage(FromEmail, ToEmail);

            mailMessage.Subject = subject;
            mailMessage.Body = EmailBody;

            SmtpClient client = new SmtpClient(Utility.Settings.GetKeyValue("SmtpServer", "SMTP.Partners.org"));
            client.Send(mailMessage);

        }

        public static void SendEmail(string FromEmail, string ToEmail, string EmailSubject, string EmailBody)
        {
            MailMessage mailMessage = new MailMessage(FromEmail, ToEmail);
            mailMessage.IsBodyHtml = true;

            mailMessage.Subject = EmailSubject;
            mailMessage.Body = EmailBody;

            SmtpClient client = new SmtpClient(Utility.Settings.GetKeyValue("SmtpServer", "SMTP.Partners.org"));
            client.Send(mailMessage);
        }
    }
}